class ArticlesController < ActionController::Base
      
  def index
    @articles = Article.find(:all)
  end
  def new
    @article = Article.new
  end
  def edit
    @article = Article.find(params[:id])
  end
  def show
    @article = Article.find(params[:id])
  end
  def update
    @article = Article.find(params[:id])
    (@article.update_attributes(params[:article])) ?
      redirect_to(:action => 'show', :id => params[:id]) : redirect_to(:action => 'new')
  end
  def create
    ((@article = Article.create(params[:article])) && @article.valid?) ?
      redirect_to(:action => 'show', :id => @article.id) : render(:action => 'new')
  end
  def destroy
    Article.find(params[:id]).destroy
    redirect_to :action => 'index'
  end
  def empty_collector
    @articles = nil
  end
end